/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.
 */

package com.huawei.chengdu.meetingdemo.util;

import com.huawei.chengdu.meetingdemo.presenter.MeetingManager;

/**
 * 项目名称：IdeaUI
 * 版    本：1.0.0
 * 公    司：华为
 * 开发小组：UI开发组
 * -------------------------------------------
 * 类名：SearchSiteThread
 * 描述：输入时防止连续搜索
 *
 * @author ：gwx582225
 * @since ：2021/09/03
 */
public class SearchSiteThread extends Thread {
    private static String threadName = "SEARCH_SITE_THREAD";
    private String inputStr;
    private int searchSource;
    private boolean isAutoFlag;

    public SearchSiteThread(String inputStr, int searchSource, boolean isAutoFlag) {
        setName(threadName);
        this.inputStr = inputStr;
        this.searchSource = searchSource;
        this.isAutoFlag = isAutoFlag;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(500);
            MeetingManager.getInstance().searchLocalAndLDAPSiteList(inputStr, searchSource, isAutoFlag);
            LogUtil.info(threadName + " searchSource=" + searchSource);
        } catch (InterruptedException e) {
            LogUtil.debug(threadName + " SEARCH_SITE_THREAD Error=" + e);
            Thread.currentThread().interrupt();
        }
    }
}
